#include<iostream>
using namespace std;
int main(){
  int m,n,need,p;
  cin>>m>>n;
  for(int i=0;i<n;i++){
    cin>>need;
    if(need>m)p++;
    else m-=need;
  }
  cout<<p;
}